<?php

class CompleteGraph extends Graph {

	protected $type = 3;

	protected function generateMatrix() {
		$numberOfVertices = count($this->vertices);
		for ($i = 1; $i <= $numberOfVertices; $i++) {
			for ($j = $i; $j <= $numberOfVertices; $j++) {
				if ($i == $j) {
					$edge = 0;
				} else {
					$edge = 1;
				}

				if ($edge) {
					$this->matrix[$i][$j] = $edge;
					$this->matrix[$j][$i] = $edge;
				}
			}
		}
	}

}